﻿using DI;
using Core.Context;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StructureMap.Pipeline;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Library.Logging;
using Core.Domain;
using Core.Factories;
using Core.IServices;
using Insurance.Repositories;

namespace Tests.Assembler
{
    [TestClass]
    public class BootstrapperTest
    {
        [TestInitialize()]
        public void Initialize()
        {
            Bootstrapper.Init(new SingletonLifecycle());
        }

        [TestCleanup()]
        public void Cleanup()
        {

        }

        [TestMethod]
        public void Bootstrapper_ILogger_Can_Load()
        {            
            //Act
            var obj = Bootstrapper.Resolve<ILogger>();

            //Assert
            Assert.IsNotNull(obj);
        }

        [TestMethod]
        public void Bootstrapper_IWorkflowFactory_Can_Load()
        {
            //Act
            var obj = Bootstrapper.Resolve<IWorkflowFactory>();

            //Assert
            Assert.IsNotNull(obj);
        }

        [TestMethod]
        public void Bootstrapper_IPolicyService_Can_Load()
        {
            //Act
            var obj = Bootstrapper.Resolve<IPolicyService>();

            //Assert
            Assert.IsNotNull(obj);
        }        

        [TestMethod]
        public void Bootstrapper_OfficeDbContext_Can_Load()
        {
            //Act
            var obj = Bootstrapper.Resolve<OfficeDbContext>();
            var list = obj.Policies.ToList();

            //Assert
            Assert.IsNotNull(obj);
            Assert.IsNotNull(list);
        }
    }
}
